<template>
  <div>
    <image
      mode="widthFix"
      :src="'https://mini.jiaw.com/img/3229720220224.jpg'"
      alt=""
    />
    <div class="content">
      <p class="title">今日ok卡剩余额度</p>
      <p class="money">¥{{ money }}</p>
      <p class="tip">申领截止时间 18:30:00</p>
      <!-- #ifdef MP-WEIXIN -->
      <button
        class="login"
        open-type="getUserProfile"
        @click="login"
        v-if="!userInfo.memberName"
      >
        立即申领ok卡
      </button>
      <button
        type="default"
        v-if="userInfo.memberName && !userInfo.phone"
        class="get-phone"
        @getphonenumber="getUserPhone"
        open-type="getPhoneNumber"
      >
        立即申领ok卡
      </button>
      <button
        class="member-center"
        @click="apply"
        v-if="userInfo.memberName && userInfo.phone"
      >
        立即申领ok卡
      </button>
      <!-- #endif -->
      <!-- #ifdef MP-ALIPAY -->
      <button @click="login" onTap="getAuthCode" v-if="!userInfo">
        立即申领ok卡
      </button>

      <button
        open-type="getAuthorize"
        @getAuthorize="getUserPhone"
        @error="onAuthError"
        scope="phoneNumber"
        v-if="userInfo && !userInfo.phone"
      >
        立即申领ok卡
      </button>
      <button
        class="member-center"
        @click="apply"
        v-if="userInfo && userInfo.phone"
      >
        立即申领ok卡
      </button>
      <!-- #endif -->
    </div>
  </div>
</template>

<script>
import mixins from '@/mixins'
import { receiveQualification } from '@/api'
export default {
  mixins: [mixins],
  data() {
    return {
      money: ''
    }
  },
  mounted() {
    receiveQualification().then(res => {
      this.money = res
    })
  },
  methods: {
    apply() {
      uni.navigateTo({
        url: '/pages/package/apply-card/detail'
      })
    }
  },
  onShow: function() {
    receiveQualification().then(res => {
      this.money = res
    })
  }
}
</script>

<style lang="less" scoped>
image {
  width: 100%;
}
.content {
  display: flex;
  flex-direction: column;
  align-items: center;
  .title {
    color: #b3292b;
    font-size: 23px;
    margin-top: 60px;
  }
  .money {
    font-size: 36px;
    color: #b3292b;
    margin: 20px 0;
  }

  button {
    margin-top: 30px;
    padding: 3px 70px;
    border-radius: 30px;
  }
}
</style>
